package com.atguigu.yygh.hosp.controller;


import com.atguigu.yygh.common.utils.R;
import com.atguigu.yygh.hosp.service.DepartmentService;
import com.atguigu.yygh.hosp.service.ScheduleService;
import com.atguigu.yygh.model.hosp.Schedule;
import com.atguigu.yygh.vo.hosp.DepartmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author lenovo
 */
@RestController
@RequestMapping("/admin/hosp/schedule")
@Api(tags = "排班管理")

public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    @ApiOperation("获取排班日期")
    @GetMapping("/getDataList/{page}/{size}/{hoscode}/{depcode}")
    public R getDateList(@ApiParam(value = "页码",required = true) @PathVariable Integer page,
                     @ApiParam(value = "个数",required = true)@PathVariable Integer size,
                     @ApiParam(value = "医院编号",required = true)@PathVariable String hoscode,
                     @ApiParam(value = "科室编号",required = true)@PathVariable String depcode){

        Map<String, Object> map = scheduleService.getDateList(page, size, hoscode, depcode);


        return R.ok().data(map);
    }

    @ApiOperation("获取排班医生")
    @GetMapping("/getDoctorList/{hoscode}/{depcode}/{workDate}")
    public R getDoctorList(@ApiParam(value = "医院编号",required = true) @PathVariable String hoscode,
                         @ApiParam(value = "科室编号",required = true)@PathVariable String depcode,
                         @ApiParam(value = "日期",required = true)@PathVariable String workDate){

        List<Schedule> doctorList = scheduleService.getDoctorList(hoscode, depcode, workDate);



        return R.ok().data("doctorList",doctorList);
    }

}
